package com.smart.platform.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.smart.platform.entity.Respond;
import com.smart.platform.entity.Students;
import com.smart.platform.mapper.RespondMapper;
import com.smart.platform.service.RespondService;
import com.smart.platform.service.StudentsService;
import com.smart.platform.service.TeaClassesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RespondServiceImpl extends ServiceImpl<RespondMapper, Respond> implements RespondService {
    @Autowired
    private TeaClassesService teaClassesService;

    @Autowired
    private StudentsService studentsService;


    /**
     * 前端传递过来教师算管理的单个年级 即 班级信息
     * 对于获取学生来说 只需要年级和班级就可以定位到一个班的数据
     *
     * @param
     * @param
     * @return
     */
    @Override
    public List<Students> AllList(Integer classes, Integer grade) {

        LambdaQueryWrapper<Students> queryWrapper = new LambdaQueryWrapper<>();

        //利用前端请求时携带的班级和年级信息 固定到该老师所管理的某个班级下所有学生的数据 用于数据回显
        queryWrapper.eq(Students::getClasses, classes)
                .eq(Students::getGrade, grade);

        return studentsService.list(queryWrapper);
    }
}
